package com.sxt.controller;

import com.sxt.common.validator.ValidatorUtil;
import com.sxt.domain.BusCar;
import com.sxt.query.BusCarQuery;
import com.sxt.service.BusCarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 车辆控制类
 */
@RestController
@RequestMapping("car")
public class BusCarController {
    @Autowired
    private BusCarService busCarService;

    /**
     * 车辆的分页查询
     * @param query
     * @return
     */
    @RequestMapping("page.do")
    public Object page(BusCarQuery query) {
        return busCarService.queryPage(query);
    }

    /**
     * 新增车辆数据
     *
     * @param busCar
     * @return
     */
    @RequestMapping("add.do")
    public Object add(BusCar busCar) {
        // 进行数据格式校验
        ValidatorUtil.validator(busCar);
        return busCarService.add(busCar);
    }

}
